package com.kjlink.internal.report4vue.statictics.service;

import com.kjlink.internal.report4vue.base.service.BaseApiService;
import com.kjlink.internal.report4vue.statictics.response.*;
import com.kjlink.internal.workreport.jira.mapper.JiraMapper;
import com.kjlink.internal.workreport.project.mapper.ProjectMapper;
import com.kjlink.internal.workreport.report.mapper.WorkReportMapper;
import com.kjlink.internal.workreport.user.mapper.UserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 描述:
 *
 * @author Vic.xu
 * @since 2024-11-27 13:54
 */
@Service
public class ApiSummaryService extends BaseApiService {

    @Resource
    private UserMapper userMapper;

    @Resource
    private WorkReportMapper workReportMapper;

    @Resource
    private ProjectMapper projectMapper;

    @Resource
    private JiraMapper jiraMapper;

    /**
     * 数量统计： 用户 / 日报 / 项目
     */
    public ApiSummaryResponse summary() {
        ApiSummaryResponse summaryResponse = new ApiSummaryResponse();
        ApiUserSummary userSummary = userMapper.summary();
        summaryResponse.setUserSummary(userSummary);

        ApiReportSummary reportSummary = workReportMapper.summary();
        summaryResponse.setReportSummary(reportSummary);

        ApiProjectSummary projectSummary = projectMapper.summary();
        summaryResponse.setProjectSummary(projectSummary);

        ApiJiraSummary jiraSummary = jiraMapper.summary();
        summaryResponse.setJiraSummary(jiraSummary);
        return summaryResponse;
    }
}
